package cn.site.modules.cms.service;

import cn.site.core.service.BaseService;
import cn.site.modules.cms.dao.SiteDao;
import cn.site.modules.cms.entity.Site;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by ZGJ on 2015/3/5.
 */
@Service
@Transactional(readOnly = true)
public class SiteService extends BaseService{

    @Autowired
    private SiteDao siteDao;

    public Site get(int id){
        return  siteDao.findOne(id);
    }

    @Transactional(readOnly = false)
    public void save(Site site){
        siteDao.save(site);
    }

    public List<Site> getList() {

        return siteDao.findAll();
    }

    @Transactional(readOnly = false)
    public void delte(int id) {

        siteDao.delete(id);
    }
}
